<?php $this->load->view('common/header');?>

<body>
<?php $this->load->view('common/user_center');?>
<div class="main_box">
    <?php $this->load->view('common/menu');?>
    <div class="right_box f_r">
        <div class="title">
            <span class="f_l">请选择支付方式</span>
        </div>
        <div class="pay_content">
            <div class="sure_pay_price">
                <span>订单总金额：<em><?php echo $order['order_price'];?>元</em></span>
                <p><?php echo $notice;?></p>
            </div>
            <div class="the_way_pay">
                <ul>
                    <li class="pay_type on" action="1">
                        <span class="f_l">
                            <i class="ico ico_a"></i>
                            <em>销售贷支付</em>
                            <p>可用余额：<b><?php echo $member['user_money_real'];?>元</b></p>
                        </span>
                        <a href="#" class="f_r ico">&nbsp;</a>
                    </li>
                    <li class="pay_type" action="2">
                        <span class="f_l">
                            <i class="ico ico_b"></i>
                            <em>线下支付</em>
                            <p>请保持电话畅通，财务会在2小时内联系您</p>
                        </span>
                        <a href="#" class="f_r ico">&nbsp;</a>
                    </li>
                </ul>
            </div>
            <input type="hidden" value="<?php echo $order['order_no']; ?>" id="order_no" />
            <div class="nav_box">
                <a href="javascript:;" id="order_pay">确定支付</a>
            </div>
        </div>
    </div>
</div>
<script>
    // 提交
    $("#order_pay").on("click",function(){
        var pay_type = $(".pay_type.on").attr("action");
        var order_no = $("#order_no").val();
        var URL= baseurl+"index.php/vip/orders/pay_order_do";
        if(pay_type == "" || pay_type == null || pay_type == undefined){
            layer.msg("请选择支付类型");
            return false;
        }
        $.ajax({
            type: "post",
            url: URL,
            dataType:'json',
            data: {
                'pay_type':pay_type,
                'order_no':order_no,
                'csrf_test_name': ci_csrf_token()
            },
            success: function(data){
                if(data.status == 200){
                    window.location.href = data.url;
                }else if(data.status == 500){
                    layer.msg(data.msg, {
                        time: 1000, //1s后自动关闭
                        shade: 0.1
                    },function () {
                        window.location.href = data.url;
                    });
                }else{
                    layer.msg(data.msg);
                    return false;
                }

            }
        });
    });

    $(".pay_type").click(function () {
        $(this).addClass("on");
        $(this).siblings().removeClass("on");
    });
    $(".pay_type").click(function () {
        $(this).addClass("on");
        $(this).siblings().removeClass("on");
    });
</script>
<!--]] user -->
<!-- coypright [[-->
<?php $this->load->view('common/footer');?>
<!--]] coypright -->
</body>
</html>
